Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

1.7K
Vistas
Angular Error: NodeInjector: NOT_FOUND [ControlContainer]

core.js:5873 ERROR Error: NodeInjector: NOT_FOUND [ControlContainer]

Sometimes when I restart the project it runs perfectly. There are only changes in app.component.html :

<div class="container">
  <div class="row">
    <div class="col-md-4">
      <form action="">

        <div class="form-group">
          <label for="">Username</label>
          <input type="text" name="username" class="form-control" />
        </div>
        <div class="form-group">
          <label>Password</label>
          <input type="password" class="form-control">
        </div>
        <div class="form-group">
          <label>Confirm Password</label>
          <input type="password" class="form-control">
        </div>
        <div>
          <button type="submit" class="btn btn-primary btn-block">Register</button>
        </div>
      </form>
      
    </div>
  </div>
</div>
over 4 years ago · Santiago Trujillo
9 Respuestas
Responde la pregunta

0

In app.module.ts I add ReactiveFormsModule in my imports section. Remember to import it at the top as: import { ReactiveFormsModule} from '@angular/forms.

In your app.component.ts you have to define FormGroup instance and initialize/register it via ngOnInit method as below:

    import { FormGroup, FormControl } from '@angular/forms'; //imports
.......................................................................
    myForm:FormGroup;  
    ngOnInit(){
         this.myForm = new FormGroup({          
               'name':new FormControl(null), //note, can have up to 3 Constructor Params: default value, validators, AsyncValidators
               'email':new FormControl(null,Validators.email)

          })
    }

Then bind form to the FormGroup instance myForm:

<form [formGroup]="myForm">

Note that name and email are controls in the form that needs binding using formControlName :

<input type="text" name="name" formControlName="name">
over 4 years ago · Santiago Trujillo Denunciar

0

you have to import both, import { FormsModule } from '@angular/forms'; import { ReactiveFormsModule } from '@angular/forms'; into your corresponding module.ts file. that worked for me.

over 4 years ago · Santiago Trujillo Denunciar

0

I ran into a similar scenario.

Issue is that angular v9 didn't liked @Host() any more. Fix is removing @Host() from dependency declaration in the constructor.

https://github.com/angular/angular/issues/31539

over 4 years ago · Santiago Trujillo Denunciar

0

In your code formGroup is missing try this: <form [formGroup] = "">

over 4 years ago · Santiago Trujillo Denunciar

0

In my case, I had forgotten to put ReactiveFormsModule to the imports section in the corresponding .spec.ts file.

over 4 years ago · Santiago Trujillo Denunciar

0

Your question is very similar to this question and your code looks missing [formGroup] as it is mentioned in this question:

Angular 5: "No provider for ControlContainer"

If you try its answer, would that work for you?

over 4 years ago · Santiago Trujillo Denunciar

0

Make sure you have all the below conditions correctly configured

In app.module.ts

import { ReactiveFormsModule } from '@angular/forms';

@NgModule({
  declarations: [],
  imports: [
   ReactiveFormsModule
  ],
  providers: [],
  bootstrap: []
})

In app.component.ts

userForm:FormGroup = new FormGroup({
      'username': new FormControl(null,Validators.required),
      'password': new FormControl(null,Validators.required),
      'confirm-password': new FormControl(null,Validators.required)
})

In HTML code

<form [formGroup]="userForm">
......
</form>
over 4 years ago · Santiago Trujillo Denunciar

0

I came across the same issue with Angular 9 and I already had ReactiveFormsModule and FormsModule imported.

Turns out that @Host() decorator is not working with Ivy. Only solution that helped is removing @Host() from the dependency declaration in the constructor.

Angular new Rendering engine Ivy doesn't like @Host() decorator.

over 4 years ago · Santiago Trujillo Denunciar

0

if you are using Modal for Ionic

Then import this

import { FormGroup, FormControl } from '@angular/forms'; //imports

to the parent module of the modal.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda